const KoaRouter = require("@koa/router");
const {
  getCategoryBanners,
  getCategoryTheme,
  getThemeIncludeCategory,
  getCategoryByThemeId,
  getCategoryByRandom,
  getActivityClassify,
  getActivityByRecommend,
  releaseActivity,
  getActivity,
  complaint,
  opinion,
} = require("../controller/community.controller");
const { verifyAuth } = require("../middleware/authority.middleware");

// 1. 创建路由对象
const communityRouter = new KoaRouter({ prefix: "/community" });

// 2. 定义路由中的映射
// 获取社区轮播图
communityRouter.get("/getCategoryBanners", getCategoryBanners);
// 获取主题
communityRouter.get("/getCategoryTheme", getCategoryTheme);
// 获取主题包含圈子
communityRouter.get("/getThemeIncludeCategory", getThemeIncludeCategory);
// 根据主题获取圈子
communityRouter.get("/getCategoryByThemeId/:themeId", getCategoryByThemeId);
// 随机获取圈子
communityRouter.get("/getCategoryByRandom", getCategoryByRandom);
// 获取活动分类
communityRouter.get("/getActivityClassify", getActivityClassify);
// 推荐活动
communityRouter.get("/getActivityByRecommend", getActivityByRecommend);
// 发布活动
communityRouter.post("/releaseActivity", verifyAuth, releaseActivity);
// 分页获取活动
communityRouter.get("/getActivity", getActivity);
// 举报
communityRouter.post("/complaint", verifyAuth, complaint);
// 意见
communityRouter.post("/opinion", verifyAuth, opinion);

module.exports = communityRouter;
